package com.kly.chatter.db.dao.impl;
import com.fqgj.common.base.AbstractBaseMapper;
import com.google.common.collect.Maps;
import com.kly.chatter.db.dao.PrivateUnlockRewardDao;
import com.kly.chatter.db.entity.PrivateUnlockRewardDBO;
import com.kly.chatter.db.entity.PrivateUnlockRewardEntity;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;

/**
* User: a
* Date: 2023-10-07
* Time: 15:48:32.847
*/

@Repository
public class PrivateUnlockRewardDaoImpl extends AbstractBaseMapper<PrivateUnlockRewardEntity> implements PrivateUnlockRewardDao {


    @Override
    public List<PrivateUnlockRewardDBO> listPrivateUnlockReward(Integer ppvType) {
        return this.getSqlSession().selectList(this.getStatement("listPrivateUnlockReward"), ppvType);
    }

    @Override
    public BigDecimal getUnlockTotalReward(String chatterCode, Integer rewardDate) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("chatterCode", chatterCode);
        params.put("rewardDate", rewardDate);
        return (BigDecimal) this.getSqlSession().selectOne(this.getStatement("getUnlockTotalReward"), params);
    }

    @Override
    public BigDecimal getUnlockRewardByType(String chatterCode, Integer rewardDate, Integer type, Integer rewardType) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("chatterCode", chatterCode);
        params.put("rewardDate", rewardDate);
        params.put("type", type);
        params.put("rewardType", rewardType);
        return (BigDecimal) this.getSqlSession().selectOne(this.getStatement("getUnlockRewardByType"), params);
    }

    @Override
    public Integer getUnlockNum(String chatterCode, Integer rewardDate, Integer type) {
        final HashMap<String, Object> params = Maps.newHashMap();
        params.put("chatterCode", chatterCode);
        params.put("rewardDate", rewardDate);
        params.put("type", type);
        return (Integer) this.getSqlSession().selectOne(this.getStatement("getUnlockNum"), params);
    }
}